package com.szcinda.repository;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import java.time.LocalDate;
import java.time.LocalDateTime;

@EqualsAndHashCode(callSuper = true)
@Data
@Entity
public class ZadOrder extends BaseEntity {
    private String clientId;
    private String clientName;
    private String bookName;
    private String orderNumber;
    private String businessId;
    private String businessNumber;
    private String bookNumber;
    private LocalDate pickDate;
    private String pickPlace;
    private int quantity;
    private double volume;
    private String cabinetType;
    private String cabinetNumber;
    private String calculateType;
    private LocalDate preDepartureTime;
    private LocalDate actDepartureTime;
    private String originPlace;
    private String destPlace;
    private String carrierId;
    private String carrierName;
    private String userId;
    private String userName;
    private String carrierDeparturePort;// 出境口岸
    private String cabinetNumberArr;
    private String goodsName;
    private String goodsDetailName;
    private Double goodsWeight;
    private String customsType;
    private LocalDateTime orderArriveTime;
    private LocalDateTime orderLeaveTime;
    private int orderBeyondDays;
    private LocalDate packageReturnDate;
    private int packageUseDays;
    private String remark;

    private String billRemark;// 账单备注

    private String businessCode;
    public boolean alert;

    private double overFee;// 超期堆存费
    private String overFeeCurrency; // 超期堆存费币种

    private String status; // 订单状态

    private String packagePic;
    private String customsFile;
    private String carFile;
    private String packageSolution;
    private String stFile;
    private String preOrderConfirm;
    private String transportOrder;
    private String customsReleaseOrder;
    private LocalDateTime arriveTime;
    private String dskAtbMrn;
    private String aging;

    private String organizationId;
    private String organizationName;
    private String invoice = BillType.STATUS_WKP;
    private String settlement = BillType.STATUS_WJS;
    private String outInvoice = BillType.STATUS_WKP;
    private String outSettlement = BillType.STATUS_WJS;

    public void checkCanLock() {
        if ((BillType.STATUS_YKP.equals(this.invoice) && BillType.STATUS_YJS.equals(this.settlement)) || (BillType.STATUS_YKP.equals(this.outInvoice) && BillType.STATUS_YJS.equals(this.outSettlement))) {
            this.setStatus(OrderStatus.CONFIRMED);
        }
    }
}
